package com.hc.dao;

import com.hc.bean.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserDao {
    @Select("select * from user")
    public List<User> findAll();

    @Select("select * from user where name like concat('%',#{name},'%')")
    public List<User> findUserByName(String name);

    @Insert("insert into user values(#{id},#{name},#{age})")
    public Integer addUser(User user);

    @Update("update user set name=#{name},age=#{age} where id=#{id}")
    public Integer updateUser(User user);

    @Delete("delete from user where id=#{id}")
    public Integer deleteUser(Integer uid);

    @Select("select * from user where id=#{id}")
    public User getUserById(Integer uid);
}
